質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
デバッグ

デバッグはプログラムのバグや欠陥を検知し、開発中のバグを取り除く為のプロセスを指します。

Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

Q&A

1回答

882閲覧

STSで”未定義です”というエラーについて

退会済みユーザー

退会済みユーザー

総合スコア0

デバッグ

デバッグはプログラムのバグや欠陥を検知し、開発中のバグを取り除く為のプロセスを指します。

Thymeleaf

Thymeleaf(タイムリーフ)とは、Java用のテンプレートエンジンで、特定のフレームワークに依存せず使用することが可能です。

Spring Boot

Spring Bootは、Javaのフレームワークの一つ。Springプロジェクトが提供する様々なフレームワークを統合した、アプリケーションを高速で開発するために設計されたフレームワークです。

0グッド

0クリップ

投稿2023/05/09 04:33

編集2023/05/09 07:17

実現したいこと

エラーの原因を見つけを解消したい

前提 STSを使いアプリ作成の練習をしています。再起動するとDescription Resource Path Location Type

メソッド remove(String, char) は型 StringUtils で未定義です PlaceMasterEntityWrapper.java /kdc/src/main/java/com/kdc/common/entity/db というエラーが出ます。
StringUtilsは特にいじったり編集する必要がないと規則があるため、これらの原因と対応策を教えていただきたいです。
よろしくお願いします。(2つあります)

①public void setLongitudeandlatitude(String longitudeandlatitude) {
super.setLongitudeandlatitude(longitudeandlatitude);
longitudeandlatitude = StringUtils.remove(longitudeandlatitude, '(');
longitudeandlatitude = StringUtils.remove(longitudeandlatitude, ')');
String temp[] = longitudeandlatitude.split(",");
this.latitude = new BigDecimal(temp[0]);
this.longitude = new BigDecimal(temp[1]);
}


// 末尾の区切り文字を切り捨てて格納
// 場所リスト
form.setPointList(StringUtils.removeEnd(pointListStr.toString(), ";"));
// 半径リスト
form.setRadiusList(StringUtils.removeEnd(radiusListStr.toString(), ";"));
// 場所名リスト
form.setPlaceNameList(StringUtils.removeEnd(placeNameListStr.toString(), ";"));
// アイコンリスト
form.setPlaceIconIdList(StringUtils.removeEnd(placeIconIdListStr.toString(), ";"));
// 場所タイプリスト
form.setPlaceTypeList(StringUtils.removeEnd(placeTypeListStr.toString(), ";"));

// ユーザデフォルトアイコン List<IconDataSet> userIconList = KdcCommonUtils.getUserDefaultIconList(); Map<Integer, byte[]> userIconMap = new LinkedHashMap<>(); for (IconDataSet userIcon : userIconList) { Integer authlevel = KdcCommonUtils.nullSafeParseInt(StringUtils.right(userIcon.getIconName(), 2)); userIconMap.put(authlevel, userIcon.getIconData()); } // マーカーアイコン List<IconDataSet> markerIconList = KdcCommonUtils.getMarkerIconList(); Map<Integer, byte[]> markerIconMap = new LinkedHashMap<>(); for (IconDataSet markerIcon : markerIconList) { Integer markerId = KdcCommonUtils.nullSafeParseInt(StringUtils.right(markerIcon.getIconName(), 2)); markerIconMap.put(markerId, markerIcon.getIconData()); } // 最新位置をマップ化 Map<String, UserLocationEntityWrapper> userLocationMap = new LinkedHashMap<>(); List<UserLocationEntityWrapper> userLocationList = userLocationMapper.selectAll(CommonConst.FLG_OFF,form.getCurrentGroupId(), true); for (UserLocationEntityWrapper userLocation : userLocationList) { userLocationMap.put(userLocation.getUserid(), userLocation); } // DBよりユーザ位置履歴を取得して隠し項目に設定 StringBuilder markerListAllStr = new StringBuilder(); StringBuilder markerListLatestStr = new StringBuilder(); StringBuilder infoWindowListStr = new StringBuilder(); StringBuilder userIconListStr = new StringBuilder(); StringBuilder lineColorListStr = new StringBuilder(); StringBuilder lineOpacityListStr = new StringBuilder(); StringBuilder markerColorListStr = new StringBuilder(); StringBuilder userIdListStr = new StringBuilder(); List<WebUserViewEntity> userList = new ArrayList<>(); // 有効ユーザのみを表示 List<UserMasterEntity> userMasterList = this.webMainMapper.getValidUser(); if (userMasterList != null) { for (UserMasterEntity userMaster : userMasterList) { if (userLocationMap.containsKey(userMaster.getUserid())) { // ユーザの変わり目に"/"を追加 if (markerListAllStr.length() > 0) { markerListAllStr.deleteCharAt(markerListAllStr.length() - 1); markerListAllStr.append("/"); infoWindowListStr.deleteCharAt(infoWindowListStr.length() - 1); infoWindowListStr.append("/"); } // 当日の位置情報が存在するユーザは最新位置と履歴を表示する if (StringUtils.equals(KdcCommonUtils.getNowDateString(), KdcCommonUtils.timestampToDateString( userLocationMap.get(userMaster.getUserid()).getLastlocationdate()))) { // 最新位置リスト UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴 List<UserLocationRecordEntityWrapper> userLocationRecordList = userLocationRecordMapper .selectByUserIdDate(userMaster.getUserid(), KdcCommonUtils.getNowDateString()); for (UserLocationRecordEntityWrapper userLocationRecord : userLocationRecordList) { // 位置履歴リスト markerListAllStr.append(userLocationRecord.getLatitude()).append(",") .append(userLocationRecord.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocationRecord.getReceivedate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocationRecord.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr.append( ReceptionStatusEnum.valueOf(userLocationRecord.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 当日の位置情報が存在しないユーザは過去の位置情報のみを表示 UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴リスト markerListAllStr.append(userLocation.getLatitude()).append(",") .append(userLocation.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocation.getLastlocationdate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocation.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr .append(ReceptionStatusEnum.valueOf(userLocation.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 位置情報自体が登録されていないユーザは無視する continue; } // ユーザ表示色オブジェクト UserColorSet colorSet = new UserColorSet(null, userMaster.getLinecolor(), userMaster.getMarkercolor()); // アイコンリスト try { byte[] userIconFile; if (StringUtils.isNotEmpty(userMaster.getIconid())) { userIconFile = userMaster.getIconfile(); } else { userIconFile = userIconMap.get(userMaster.getAuthlevel()); } userIconListStr .append(KdcCommonUtils.createUserMarkerIconString(userIconFile, markerIconMap.containsKey(colorSet.getMarkerColorId()) ? markerIconMap.get(colorSet.getMarkerColorId()) : markerIconMap.get(1))) .append(";"); } catch (IOException e) { e.printStackTrace(); } // 移動履歴表示色リスト lineColorListStr.append(colorSet.getLineColorRGBHex()).append(";"); // 移動履歴表示不透明度リスト lineOpacityListStr.append(colorSet.getLineColorAlpha()).append(";"); // 移動地点マーカー表示色リスト // markerColorListStr.append(colorSet.getMarkerColorRGBHex()).append(";"); markerColorListStr.append(colorSet.getLineColorRGBHex()).append(";"); // userIdリスト作成 userIdListStr.append(userMaster.getUserid()).append(";"); // ユーザリスト作成 userList.add(this.makeWebUserViewEntity(userMaster, userIconMap)); } } //グループ番号取得 Map<String, String> groupMap = new LinkedHashMap<>(); Map<String, String> groupNameMap = new LinkedHashMap<>(); // ユーザマスタからグループID一覧を取得し、コンボボックスに設定 List<GroupInfoEntity> groupList = groupMasterMapper.selectAll(CommonConst.FLG_OFF); for (int cntCombo = 0; cntCombo < groupList.size(); cntCombo++) { groupMap.put(groupList.get(cntCombo).getGroupid(), groupList.get(cntCombo).getGroupname()); groupNameMap.put(groupList.get(cntCombo).getGroupname(), groupList.get(cntCombo).getGroupname()); } form.setCmbGroup(groupMap); // 末尾の区切り文字を切り捨てて格納 form.setMarkerListAll(StringUtils.removeEnd(markerListAllStr.toString(), ";")); form.setMarkerListLatest(StringUtils.removeEnd(markerListLatestStr.toString(), ";")); form.setInfoWindowList(StringUtils.removeEnd(infoWindowListStr.toString(), ";")); form.setUserIconList(StringUtils.removeEnd(userIconListStr.toString(), ";")); form.setLineColorList(StringUtils.removeEnd(lineColorListStr.toString(), ";")); form.setLineOpacityList(StringUtils.removeEnd(lineOpacityListStr.toString(), ";")); form.setMarkerColorList(StringUtils.removeEnd(markerColorListStr.toString(), ";")); form.setUserIdList(StringUtils.removeEnd(userIdListStr.toString(), ";")); form.setUserList(userList); }

発生している問題・エラーメッセージ

・メソッド removeEnd(String, String) は型 StringUtils で未定義です
・メソッド remove(String, char) は型 StringUtils で未定義です

試したこと

再起動、デバッグ
biuld.gradleの編集、リフレッシュ

補足情報(FW/ツールのバージョンなど) spring tool suite4

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2023/05/09 04:38

クラス定義の冒頭 パッケージやインポートのところも記載してください。 でないとStringUtilsがどこの何なのか分かりません。 外部ライブラリであればその旨も記載を(SpringならMavenもしくはGradleの設定ファイルに記載があると思います)
退会済みユーザー

退会済みユーザー

2023/05/09 04:43

package com.kdc.web.main; import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Base64; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.kdc.common.entity.db.GroupInfoEntity; import com.kdc.common.entity.db.PlaceMasterEntityWrapper; import com.kdc.common.entity.db.UserLocationEntityWrapper; import com.kdc.common.entity.db.UserLocationRecordEntityWrapper; import com.kdc.common.entity.db.UserMasterEntity; import com.kdc.common.entity.web.WebUserViewEntity; import com.kdc.common.enums.PlaceTypeEnum; import com.kdc.common.enums.ReceptionStatusEnum; import com.kdc.common.util.CommonConst; import com.kdc.common.util.KdcCommonUtils; import com.kdc.common.util.IconDataSet; import com.kdc.common.util.UserColorSet; import com.kdc.mybatis.mapper.common.entity.GroupMasterMapper; import com.kdc.mybatis.mapper.common.entity.PlaceMasterMapper; import com.kdc.mybatis.mapper.common.entity.UserLocationMapper; import com.kdc.mybatis.mapper.common.entity.UserLocationRecordMapper; import com.kdc.mybatis.mapper.common.entity.UserMasterMapper; import com.kdc.mybatis.mapper.web.WebMainMapper; /** * メイン画面 Service クラス * * @author s.hiasa * */ @Service public class WebMainService { @Autowired private UserLocationMapper userLocationMapper; @Autowired private UserLocationRecordMapper userLocationRecordMapper; @Autowired private WebMainMapper webMainMapper; @Autowired private PlaceMasterMapper placeMasterMapper; @Autowired private UserMasterMapper userMasterMapper; @Autowired private GroupMasterMapper groupMasterMapper; /** * 初期処理. * * @param form * メイン画面フォーム */ public void init(WebMainForm form) { // Map初期表示中心座標 if (StringUtils.isEmpty(form.getMapLatitude())) { form.setMapLatitude(CommonConst.DEFAULT_MAP_LATITUDE); } if (StringUtils.isEmpty(form.getMapLongitude())) { form.setMapLongitude(CommonConst.DEFAULT_MAP_LONGITUDE); } // Map初期表示ズームレベル if (StringUtils.isEmpty(form.getMapZoomLevel())) { form.setMapZoomLevel(CommonConst.DEFAULT_MAP_ZOOM); } //グループID取得(有効なユーザーマスタよりMINグループIDを取得) if ( form.getCurrentGroupId() == null) { UserMasterEntity userMasterGrpId = userMasterMapper.selectUserGroupId(CommonConst.FLG_OFF); if ( userMasterGrpId != null ) { form.setCurrentGroupId(userMasterGrpId.getGroupid()); } } // DBより場所リスト取得 List<PlaceMasterEntityWrapper> placeList = placeMasterMapper.selectAll(CommonConst.FLG_OFF,form.getCurrentGroupId(), true); // 場所リストを表示用隠し項目に設定する // アイコンパターンリスト作成 StringBuilder placeIconDataListStr = new StringBuilder(); List<IconDataSet> placeIconList = KdcCommonUtils.getPlaceIconList(); for (IconDataSet placeIcon : placeIconList) { placeIconDataListStr.append(placeIcon.getIconName()).append(","); placeIconDataListStr.append(Base64.getEncoder().encodeToString(placeIcon.getIconData())).append(";"); } form.setPlaceIconDataList(placeIconDataListStr.toString()); StringBuilder placeTypeColorListStr = new StringBuilder(); for (PlaceTypeEnum item : PlaceTypeEnum.values()) { placeTypeColorListStr.append(item.getCode()).append(","); placeTypeColorListStr.append(item.getCircleColor()).append(","); placeTypeColorListStr.append(item.getEditColor()).append(";"); } form.setPlaceTypeColorList(StringUtils.removeEnd(placeTypeColorListStr.toString(), ";")); 失礼いたしました。冒頭部分を送ります。
m.ts10806

2023/05/09 05:31

質問編集してコード追記してください。 コメント欄ではマークダウンが使えませんし、質問本文にないので目につきにくいです。 コードが長くて入らないようであればその機能だけ使うミニマムコードやメソッドを作って確認、ご提示ください(作ってみる過程で気付けることもあります) ライブラリの対象バージョンのドキュメントも確認してくださいね。
退会済みユーザー

退会済みユーザー

2023/05/09 07:19

package com.kdc.web.main; import java.io.IOException; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.Base64; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.kdc.common.entity.db.GroupInfoEntity; import com.kdc.common.entity.db.PlaceMasterEntityWrapper; import com.kdc.common.entity.db.UserLocationEntityWrapper; import com.kdc.common.entity.db.UserLocationRecordEntityWrapper; import com.kdc.common.entity.db.UserMasterEntity; import com.kdc.common.entity.web.WebUserViewEntity; import com.kdc.common.enums.PlaceTypeEnum; import com.kdc.common.enums.ReceptionStatusEnum; import com.kdc.common.util.CommonConst; import com.kdc.common.util.KdcCommonUtils; import com.kdc.common.util.IconDataSet; import com.kdc.common.util.UserColorSet; import com.kdc.mybatis.mapper.common.entity.GroupMasterMapper; import com.kdc.mybatis.mapper.common.entity.PlaceMasterMapper; import com.kdc.mybatis.mapper.common.entity.UserLocationMapper; import com.kdc.mybatis.mapper.common.entity.UserLocationRecordMapper; import com.kdc.mybatis.mapper.common.entity.UserMasterMapper; import com.kdc.mybatis.mapper.web.WebMainMapper; /** * メイン画面 Service クラス * * @author s.hiasa * */ @Service public class WebMainService { @Autowired private UserLocationMapper userLocationMapper; @Autowired private UserLocationRecordMapper userLocationRecordMapper; @Autowired private WebMainMapper webMainMapper; @Autowired private PlaceMasterMapper placeMasterMapper; @Autowired private UserMasterMapper userMasterMapper; @Autowired private GroupMasterMapper groupMasterMapper; /** * 初期処理. * * @param form * メイン画面フォーム */ public void init(WebMainForm form) { // Map初期表示中心座標 if (StringUtils.isEmpty(form.getMapLatitude())) { form.setMapLatitude(CommonConst.DEFAULT_MAP_LATITUDE); } if (StringUtils.isEmpty(form.getMapLongitude())) { form.setMapLongitude(CommonConst.DEFAULT_MAP_LONGITUDE); } // Map初期表示ズームレベル if (StringUtils.isEmpty(form.getMapZoomLevel())) { form.setMapZoomLevel(CommonConst.DEFAULT_MAP_ZOOM); } //グループID取得(有効なユーザーマスタよりMINグループIDを取得) if ( form.getCurrentGroupId() == null) { UserMasterEntity userMasterGrpId = userMasterMapper.selectUserGroupId(CommonConst.FLG_OFF); if ( userMasterGrpId != null ) { form.setCurrentGroupId(userMasterGrpId.getGroupid()); } } // DBより場所リスト取得 List<PlaceMasterEntityWrapper> placeList = placeMasterMapper.selectAll(CommonConst.FLG_OFF,form.getCurrentGroupId(), true); // 場所リストを表示用隠し項目に設定する // アイコンパターンリスト作成 StringBuilder placeIconDataListStr = new StringBuilder(); List<IconDataSet> placeIconList = KdcCommonUtils.getPlaceIconList(); for (IconDataSet placeIcon : placeIconList) { placeIconDataListStr.append(placeIcon.getIconName()).append(","); placeIconDataListStr.append(Base64.getEncoder().encodeToString(placeIcon.getIconData())).append(";"); } form.setPlaceIconDataList(placeIconDataListStr.toString()); StringBuilder placeTypeColorListStr = new StringBuilder(); for (PlaceTypeEnum item : PlaceTypeEnum.values()) { placeTypeColorListStr.append(item.getCode()).append(","); placeTypeColorListStr.append(item.getCircleColor()).append(","); placeTypeColorListStr.append(item.getEditColor()).append(";"); } form.setPlaceTypeColorList(StringUtils.removeEnd(placeTypeColorListStr.toString(), ";")); // 場所(座標)リスト文字列 StringBuilder pointListStr = new StringBuilder(); // 半径リスト文字列 StringBuilder radiusListStr = new StringBuilder(); // 場所名リスト文字列 StringBuilder placeNameListStr = new StringBuilder(); // アイコンリスト文字列 StringBuilder placeIconIdListStr = new StringBuilder(); // 場所タイプリスト StringBuilder placeTypeListStr = new StringBuilder(); for (PlaceMasterEntityWrapper place : placeList) { // 場所リスト作成 pointListStr.append(place.getLatitude()).append(",").append(place.getLongitude()).append(";"); // 半径リスト作成 radiusListStr.append(place.getRadius()).append(";"); // 場所名リスト作成 placeNameListStr.append(place.getPlacename()).append(";"); // アイコンリスト作成 placeIconIdListStr.append(StringUtils.remove(place.getIconid(), " ")).append(";"); // 場所タイプリスト作成 placeTypeListStr.append(place.getPlacetypeflg()).append(";"); } // 末尾の区切り文字を切り捨てて格納 // 場所リスト form.setPointList(StringUtils.removeEnd(pointListStr.toString(), ";")); // 半径リスト form.setRadiusList(StringUtils.removeEnd(radiusListStr.toString(), ";")); // 場所名リスト form.setPlaceNameList(StringUtils.removeEnd(placeNameListStr.toString(), ";")); // アイコンリスト form.setPlaceIconIdList(StringUtils.removeEnd(placeIconIdListStr.toString(), ";")); // 場所タイプリスト form.setPlaceTypeList(StringUtils.removeEnd(placeTypeListStr.toString(), ";")); // ユーザデフォルトアイコン List<IconDataSet> userIconList = KdcCommonUtils.getUserDefaultIconList(); Map<Integer, byte[]> userIconMap = new LinkedHashMap<>(); for (IconDataSet userIcon : userIconList) { Integer authlevel = KdcCommonUtils.nullSafeParseInt(StringUtils.right(userIcon.getIconName(), 2)); userIconMap.put(authlevel, userIcon.getIconData()); } // マーカーアイコン List<IconDataSet> markerIconList = KdcCommonUtils.getMarkerIconList(); Map<Integer, byte[]> markerIconMap = new LinkedHashMap<>(); for (IconDataSet markerIcon : markerIconList) { Integer markerId = KdcCommonUtils.nullSafeParseInt(StringUtils.right(markerIcon.getIconName(), 2)); markerIconMap.put(markerId, markerIcon.getIconData()); } // 最新位置をマップ化 Map<String, UserLocationEntityWrapper> userLocationMap = new LinkedHashMap<>(); List<UserLocationEntityWrapper> userLocationList = userLocationMapper.selectAll(CommonConst.FLG_OFF,form.getCurrentGroupId(), true); for (UserLocationEntityWrapper userLocation : userLocationList) { userLocationMap.put(userLocation.getUserid(), userLocation); } // DBよりユーザ位置履歴を取得して隠し項目に設定 StringBuilder markerListAllStr = new StringBuilder(); StringBuilder markerListLatestStr = new StringBuilder(); StringBuilder infoWindowListStr = new StringBuilder(); StringBuilder userIconListStr = new StringBuilder(); StringBuilder lineColorListStr = new StringBuilder(); StringBuilder lineOpacityListStr = new StringBuilder(); StringBuilder markerColorListStr = new StringBuilder(); StringBuilder userIdListStr = new StringBuilder(); List<WebUserViewEntity> userList = new ArrayList<>(); // 有効ユーザのみを表示 List<UserMasterEntity> userMasterList = this.webMainMapper.getValidUser(); if (userMasterList != null) { for (UserMasterEntity userMaster : userMasterList) { if (userLocationMap.containsKey(userMaster.getUserid())) { // ユーザの変わり目に"/"を追加 if (markerListAllStr.length() > 0) { markerListAllStr.deleteCharAt(markerListAllStr.length() - 1); markerListAllStr.append("/"); infoWindowListStr.deleteCharAt(infoWindowListStr.length() - 1); infoWindowListStr.append("/"); } // 当日の位置情報が存在するユーザは最新位置と履歴を表示する if (StringUtils.equals(KdcCommonUtils.getNowDateString(), KdcCommonUtils.timestampToDateString( userLocationMap.get(userMaster.getUserid()).getLastlocationdate()))) { // 最新位置リスト UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴 List<UserLocationRecordEntityWrapper> userLocationRecordList = userLocationRecordMapper .selectByUserIdDate(userMaster.getUserid(), KdcCommonUtils.getNowDateString()); for (UserLocationRecordEntityWrapper userLocationRecord : userLocationRecordList) { // 位置履歴リスト markerListAllStr.append(userLocationRecord.getLatitude()).append(",") .append(userLocationRecord.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocationRecord.getReceivedate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocationRecord.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr.append( ReceptionStatusEnum.valueOf(userLocationRecord.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 当日の位置情報が存在しないユーザは過去の位置情報のみを表示 UserLocationEntityWrapper userLocation = userLocationMap.get(userMaster.getUserid()); markerListLatestStr.append(userLocation.getLatitude()).append(",") .append((userLocation.getLongitude())).append(";"); // 位置履歴リスト markerListAllStr.append(userLocation.getLatitude()).append(",") .append(userLocation.getLongitude()).append(";"); // 吹き出し情報リスト infoWindowListStr.append(KdcCommonUtils.nullToEmpty(userMaster.getUsername())); infoWindowListStr.append(","); infoWindowListStr.append(KdcCommonUtils.nullToEmpty( KdcCommonUtils.timeToTimeStringForDisp(userLocation.getLastlocationdate()))); infoWindowListStr.append(","); infoWindowListStr.append(userLocation.getBatterylevel()); infoWindowListStr.append(","); infoWindowListStr .append(ReceptionStatusEnum.valueOf(userLocation.getReceptionstatus()).getLabel()); infoWindowListStr.append(";"); } } else { // 位置情報自体が登録されていないユーザは無視する continue; } // ユーザ表示色オブジェクト UserColorSet colorSet = new UserColorSet(null, userMaster.getLinecolor(), userMaster.getMarkercolor()); // アイコンリスト try { byte[] userIconFile; if (StringUtils.isNotEmpty(userMaster.getIconid())) { userIconFile = userMaster.getIconfile(); } else { userIconFile = userI
退会済みユーザー

退会済みユーザー

2023/05/09 07:19

②の文章の追記です。
m.ts10806

2023/05/09 07:26

私の2023/05/09 14:31のコメント参照。 特に後半は読まれてないように感じます。
退会済みユーザー

退会済みユーザー

2023/05/09 07:29

ライブラリの対象バージョンのドキュメントも確認してくださいね。 ↑こちらの文章のことでしょうか?
m.ts10806

2023/05/09 07:37 編集

いえ、一通り。 ①コードは本文に追記してほしいと依頼したはずがコメントに投稿されている ②長いのであればその機能だけ使うミニマムコード書いてみて検証をと依頼したがされている様子がない(おそらく今の全部のコードだけ投稿している) ③コメントがいずれのレスポンスなのか不明 細かいですが、解決のためには大事なことです。赤の他人ですから、質問者の状況までは汲めません。 回答はしましたがドキュメントから分かることだけを並べています。
guest

回答1

0

ドキュメントからすると
org.apache.commons.lang3.StringUtilsにはremoveEnd(String, String) remove(String, char)もあるようなので、別のオブジェクトを見に行っている可能性があります。

例えば以下。
org.springframework.util.StringUtils

エラー詳細を辿ればどのStringUtils()を参照しようとしているかどこかに出ているはずです(開発環境によって見る場所は変わります)

ひとまず検証の方向性としては[StringUtils()]と機能名だけで呼び出すのではなく、フルでorg.apache.commons.lang3.StringUtils(hoge , hoge)のように書いてみてはどうでしょう。

ただ、何かの課題なのであれば出題者等に確認するのが最優先と思います。

投稿2023/05/09 07:35

m.ts10806

総合スコア80850

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

m.ts10806

2023/05/09 07:46 編集

ちなみに編集前の本文に >今までStringUtilsでメソッド作成”□”をしてエラーを解消していたのですが とありましたが、そもそもパッケージ化されているライブラリに要素を直に追加することはできないので、 余程の要件があったとしても「ない機能を追加」することはないです。物理的に無理。 ライブラリの利用になるので、使いたい機能がなければ、使いたい機能があるライブラリを導入するまで(そもそもライブラリを正しく使うのって案外難しい) わざわざ継承したクラスなど作って機能追加するのも結構なコストです(本当によほどのことがない限りしないし、正しく動かすためにはかなりスキルが必要)
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問