List of usage examples for org.apache.commons.lang3.builder ToStringBuilder reflectionToString
public static String reflectionToString(final Object object)
Uses ReflectionToStringBuilder
to generate a toString
for the specified object.
From source file:org.force66.aws.utils.ContextUtils.java
public static String toString(Context context) { if (context == null) { return null; }/*from w ww . j av a 2 s . c om*/ return ToStringBuilder.reflectionToString(context); }
From source file:org.jas.gui.MainWindow.java
private void updateImage(int selectedRow) { TableModel model = getDescriptionTable().getModel(); List<Metadata> metadataList = viewEngineConfigurator.getViewEngine().get(Model.METADATA); Metadata metadata = metadataList.get(selectedRow); log.info("metadata: " + ToStringBuilder.reflectionToString(metadata)); imagePanel.removeAll();/*from w w w .j a va2s. c o m*/ if (metadata.getNewCoverArt() != null) { CoverArt coverArt = metadata.getNewCoverArt(); log.info("setting coverArt to: " + coverArt.getType()); ImageIcon imageIcon = new ImageIcon(coverArt.getImageIcon()); imagePanel.add(new JLabel(imageIcon)); String label = ApplicationState.COVER_ART_FROM_LASTFM; if (coverArt.getType().equals(CoverArtType.DRAG_AND_DROP)) { label = ApplicationState.COVER_ART_FROM_DRAG_AND_DROP; } imageLabel.setText(label); } else if (metadata.getCoverArt() != null) { if (imageUtils.is300Image(metadata.getCoverArt())) { imagePanel.add(new JLabel(new ImageIcon(metadata.getCoverArt()))); } else { Image resize = imageUtils.resize(metadata.getCoverArt(), ApplicationState.THREE_HUNDRED, ApplicationState.THREE_HUNDRED); imagePanel.add(new JLabel(new ImageIcon(resize))); } imageLabel.setText(ApplicationState.COVER_ART_FROM_FILE); } else { imageLabel.setText(ApplicationState.COVER_ART_DEFAULT); } imagePanel.invalidate(); imagePanel.revalidate(); imagePanel.repaint(); }
From source file:org.jas.metadata.Mp3Reader.java
public Metadata getMetadata(File file) throws CannotReadException, IOException, TagException, ReadOnlyFileException, MetadataException { try {//from w w w .j a v a2 s. com audioFile = audioFileHelper.read(file); } catch (InvalidAudioFrameException ina) { return null; } catch (FileNotFoundException fnf) { log.error("File: " + file.getAbsolutePath() + " Not found"); configurator.getControlEngine().fireEvent(Events.LOAD_FILE, new ValueEvent<String>(file.getAbsolutePath())); return null; } if (audioFile instanceof MP3File) { MP3File audioMP3 = (MP3File) audioFile; if (!audioMP3.hasID3v2Tag()) { AbstractID3v2Tag id3v2tag = new ID3v24Tag(); audioMP3.setID3v2TagOnly(id3v2tag); try { audioFile.commit(); } catch (CannotWriteException cwe) { log.error("An error occurs when I tried to update to ID3 v2"); cwe.printStackTrace(); } } tag = audioFile.getTag(); header = audioFile.getAudioHeader(); log.info("tag: " + ToStringBuilder.reflectionToString(tag)); log.info("header: " + ToStringBuilder.reflectionToString(header)); if (jAudioTaggerCollaborator.isValid(tag, header)) { return generateMetadata(file); } } return new Metadata(); }
From source file:org.red5.io.m4a.impl.AACReader.java
/** * Creates M4A reader from file input stream, sets up metadata generation flag. * * @param f File input stream *//* w ww .ja va 2s.c o m*/ public AACReader(File f, boolean onlyHeader) throws IOException { if (null == f) { log.warn("Reader was passed a null file"); log.debug("{}", ToStringBuilder.reflectionToString(this)); } this.fis = new FileInputStream(f); // create a channel channel = fis.getChannel(); // instance an iso file from mp4parser isoFile = new IsoFile(channel); //decode all the info that we want from the atoms decodeHeader(); if (onlyHeader) return; //analyze the samples/chunks and build the keyframe meta data analyzeFrames(); //add meta data firstTags.add(createFileMeta()); //create / add the pre-streaming (decoder config) tags createPreStreamingTags(); }
From source file:org.red5.io.m4a.impl.M4AReader.java
/** * Creates M4A reader from file input stream, sets up metadata generation flag. * * @param f//from w w w . j a v a 2s . c o m * File input stream * @throws IOException * on IO error */ public M4AReader(File f) throws IOException { if (null == f) { log.warn("Reader was passed a null file"); log.debug("{}", ToStringBuilder.reflectionToString(this)); } String fileName = f.getName(); if (fileName.endsWith("m4a") || fileName.endsWith("mp4")) { // create a datasource / channel dataSource = new FileDataSourceImpl(f); // instance an iso file from mp4parser isoFile = new IsoFile(dataSource); //decode all the info that we want from the atoms decodeHeader(); //analyze the samples/chunks and build the keyframe meta data analyzeFrames(); //add meta data firstTags.add(createFileMeta()); //create / add the pre-streaming (decoder config) tags createPreStreamingTags(); } else { log.info("Unsupported file extension: {}", fileName); } }
From source file:org.red5.io.mp4.impl.MP4Reader.java
/** * Creates MP4 reader from file input stream, sets up metadata generation flag. * * @param f//from w ww . ja va 2s. co m * File input stream * @throws IOException * on IO exception */ public MP4Reader(File f) throws IOException { if (null == f) { log.warn("Reader was passed a null file"); log.debug("{}", ToStringBuilder.reflectionToString(this)); } if (f.exists() && f.canRead()) { // create a datasource / channel dataSource = new FileDataSourceImpl(f); // instance an iso file from mp4parser isoFile = new IsoFile(dataSource); //decode all the info that we want from the atoms decodeHeader(); //analyze the samples/chunks and build the keyframe meta data analyzeFrames(); //add meta data firstTags.add(createFileMeta()); //create / add the pre-streaming (decoder config) tags createPreStreamingTags(0, false); } else { log.warn("Reader was passed an unreadable or non-existant file"); } }
From source file:org.squashtest.tm.web.internal.controller.administration.UserAdministrationController.java
@ResponseBody @RequestMapping(value = "/new", method = RequestMethod.POST, params = "password") public void addUser(@ModelAttribute("add-user") @Valid UserForm userForm) { if (!currentProviderFeatures().isManagedPassword()) { adminService.addUser(userForm.getUser(), userForm.getGroupId(), userForm.getPassword()); } else {//www. j a v a 2 s.c o m // If this happens, it's either a bug or a forged request LOGGER.warn( "Received a password while passwords are managed by auth provider. This is either a bug or a forged request. User form : {}", ToStringBuilder.reflectionToString(userForm)); throw new IllegalArgumentException( "Received a password while passwords are managed by auth provider. This is either a bug or a forged request."); } }
From source file:org.squashtest.tm.web.internal.controller.administration.UserAdministrationController.java
@ResponseBody @RequestMapping(value = "/new", method = RequestMethod.POST, params = "noPassword") public void addUserWithoutCredentials(@ModelAttribute("add-user") @Valid UserForm userForm) { if (currentProviderFeatures().isManagedPassword()) { adminService.createUserWithoutCredentials(userForm.getUser(), userForm.getGroupId()); } else {// w w w . j av a 2 s.c om // If this happens, it's either a bug or a forged request LOGGER.warn( "Received no password while passwords are managed by Squash. This is either a bug or a forged request. User form : {}", ToStringBuilder.reflectionToString(userForm)); throw new IllegalArgumentException( "Received no password while passwords are managed by Squash. This is either a bug or a forged request."); } }
From source file:org.squashtest.tm.web.internal.controller.customfield.CustomFieldController.java
@RequestMapping(value = "/new", method = RequestMethod.POST) @ResponseStatus(HttpStatus.CREATED)//from w w w .j ava 2 s . c o m @ResponseBody public void createNew(@RequestBody NewCustomField field) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Will create cutsom field {}", ToStringBuilder.reflectionToString(field)); } customFieldManager.persist(field.createTransientEntity()); }
From source file:org.squashtest.tm.web.internal.controller.infolist.InfoListController.java
@RequestMapping(value = "/new", method = RequestMethod.POST, produces = ContentTypes.APPLICATION_JSON) public JsonEmptyResponseEntity createNew(@RequestBody @Valid InfoList infoList) { if (LOGGER.isDebugEnabled()) { LOGGER.debug("Will create Info list {}", ToStringBuilder.reflectionToString(infoList)); }/* www .j a v a 2 s. c om*/ infoListManager.persist(infoList); return new JsonEmptyResponseEntity(HttpStatus.CREATED); }